/**
 * Author@ Cheng Feitian
 * Date: 2021-3-30
 * Description: 空指针调用成员函数
 */

#include <algorithm>
#include <iostream>
#include <string>

using namespace std;
const int maxn = 1024;

class Person
{
public:
    int m_Age;

    void showClassName(){
        cout << "this is Person class" << endl;
    }

    void showPersonAge(){
        if (this == NULL)
        {
            return;
        }
        
        //出错的原因是因为传入的指针是为NULL
        cout << "age = " << m_Age << endl;
    }
};

void test01(){
    Person * p = NULL;

    // p->showClassName();
    p->showPersonAge();
}

int main()
{
    test01();
    return 0;
}
